package com.biz.primus.ms.promotion.api;

import com.biz.primus.base.vo.ProductPromotionTagRespVo;
import com.biz.primus.base.vo.ProductSpecialOfferPromotionRespVo;
import com.biz.primus.base.vo.PromotionBasicInfoVo;
import com.biz.primus.model.promotion.vo.ActivityVo;
import com.biz.primus.model.promotion.vo.req.*;
import com.biz.primus.model.promotion.vo.resp.OrderPromotionRespVo;
import com.biz.primus.ms.base.api.BaseApiController;
import com.biz.primus.ms.promotion.service.activity.ActivityService;
import com.biz.primus.ms.promotion.service.promotion.PromotionService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 促销ApiController
 *
 * @author david-liu
 */
@RestController
@RequestMapping(value = "soa/promotion")
public class PromotionApiController extends BaseApiController {

    @Autowired
    private PromotionService promotionService;

    @Autowired
    private ActivityService activityService;

    @PostMapping(value = "/getProductSpecialOfferPromotion")
    public ProductSpecialOfferPromotionRespVo getProductSpecialOfferPromotion(@RequestBody SingleProductSpecialOfferPriceReqVo reqVo) {
        return promotionService.getProductSpecialOfferPromotion(reqVo);
    }

    @PostMapping(value = "/getMultiProductSpecialOfferPromotion")
    public List<ProductSpecialOfferPromotionRespVo> getProductSpecialOfferPromotion(@RequestBody MultiProductSpecialOfferPriceReqVo reqVo) {
        return promotionService.getProductSpecialOfferPromotion(reqVo);
    }

    @PostMapping(value = "/getProductPromotionTags")
    public List<ProductPromotionTagRespVo> getProductPromotionTags(ProductPromotionTagReqVo reqVo) {
        return promotionService.getProductPromotionTags(reqVo);
    }

    @PostMapping(value = "/getProductPromotions")
    public List<PromotionBasicInfoVo> getProductPromotions(ProductPromotionReqVo reqVo) {
        return promotionService.getProductPromotions(reqVo);
    }

    @PostMapping(value = "/getPromotion4Order")
    public OrderPromotionRespVo getPromotion4Order(OrderPromotionReqVo reqVo) {
        return promotionService.getPromotion4Order(reqVo);
    }

    @PostMapping(value = "/takeMemberPromotions")
    public Boolean takeMemberPromotions(TakeMemberPromotionReqVo reqVo) {
        return promotionService.takeMemberPromotions(reqVo);
    }

    @GetMapping(value = "/getActivity")
    public ActivityVo getActivity(Long activityId) {
        return activityService.getActivity(activityId);
    }
}
